<?php
//By Bing Hua
include_once 'functions.php';
include_once 'insert_functions.php';
$date1 = $_GET ['date1'];
$date2 = $_GET ['date2'];
$date3 = $_GET ['date3'];
$cropNum1 = $_GET ['cropNum1'];
$cropNum2 = $_GET ['cropNum2'];
$cropNum3 = $_GET ['cropNum3'];
$cropName = $_GET ['cropName'];
$cropid = getCropId ( $cropName );
if ($cropNum1 != 0)
	if (addSeedPurchase ( $cropid, $cropNum1, $date1, null ) == false) {
		updateSeedPurchase ( $cropid, $cropNum1, $date1, null );
	}
if ($cropNum2 != 0)
	if (addPlantAdded ( $cropid, $cropNum2, $date2, null ) == false) {
		updatePlantsAdded ( $cropid, $cropNum2, $date2, null );
	}
if ($cropNum3 != 0)
	if (addPlantsTransplanted ( $cropid, $cropNum3, $date3, null ) == false) {
		updatePlantsTransplanted ( $cropid, $cropNum3, $date3, null );
	}
echo '<META HTTP-EQUIV="Refresh" Content="0; URL=insert_cropinfo.php">';
?>